package com.hua.utility.utility.tools;

import java.util.Random;

public class RandomUtils {
    
	private static final String randomString="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
	/**
	 * 获取指定个数的随机数字，返回纯数字
	 * @param num
	 * @return
	 */
	public static String getRandomNumber(int num) {
		if (num<=0) {
			return null;
		}
		String numberstr = "";
		Random random = new Random();
		int number = 0;
		for (int i=0; i<num; i++) {
			number = random.nextInt(9);
			numberstr += number;
		}
		return numberstr;
	}
	
	public static String getRandomString(int num) {
		Random random = new Random();
		int range = randomString.length();
		String str = "";
		for (int i=0; i<num; i++) {
			str += randomString.charAt(random.nextInt(range));
		}
		return str;
	}
	
	 public static void main(String[] args) {
	       for (int i=0; i<100; i++) {
	           System.out.println(getRandomNumber(10)+getRandomString(10));
	       }
	       
	       
	 }

}
